package net.davidlauzon.assemblandroid.models;

import android.util.Log;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.converters.extended.ISO8601DateConverter;
import com.thoughtworks.xstream.io.xml.XppDomDriver;

public class WithXStream {
	public WithXStream( String xml ) {
		Log.e("***************************", "BEFORE SERIALIZATION");
        // XML deserialization
        XStream xs = new XStream(new XppDomDriver());
        
        xs.registerConverter(new ISO8601DateConverter());
        
        //xs.alias("ticket", Ticket.class);
        //Ticket t = (Ticket) xs.fromXML(client.getResponse());
        xs.alias("space", Space.class);
        xs.aliasField("can-join", Space.class, "canJoin");
        xs.aliasField("created-at", Space.class, "createdAt");
        xs.aliasField("default-showpage", Space.class, "defaultShowpage");
        xs.aliasField("is-commercial", Space.class, "isCommercial");
        xs.aliasField("is-manager", Space.class, "isManager");
        xs.aliasField("is-volunteer", Space.class, "isVolunteer");
        xs.aliasField("parent-id", Space.class, "parentId");
        xs.aliasField("public-permissions", Space.class, "publicPermissions");
        xs.aliasField("team-permissions", Space.class, "teamPermissions");
        xs.aliasField("updated-at", Space.class, "updatedAt");
        xs.aliasField("watcher-permissions", Space.class, "watcherPermissions");
        xs.aliasField("wiki-name", Space.class, "wikiName");
        Space s = (Space) xs.fromXML( xml );
        
        Log.e("yo", "yo");
        Log.e("yo", "*************************** OUTPUT IS " + s.toString());
	}
}
